<%@page contentType="text/html;charset=UTF-8"%>
<%@page pageEncoding="UTF-8"%>
<%
	com.wing.ext.domain.Site_user site_user = (com.wing.ext.domain.Site_user)request.getAttribute("site_user");
	if(site_user==null){
		site_user = new com.wing.ext.domain.Site_user();
	}
 %>
<%@ include file="/pub/includ.jsp"%>
<script type="text/javascript">
	  var save = function(){
			var flag = "failure";
			if($.formValidator.pageIsValid()){
				var options = {
					type: 'POST',
					async: false,
					dataType: 'content-type',
					success: function(msg) {
						flag = msg;
					}
				}
				$('#site_userform').ajaxSubmit(options);
			}
			return flag;
		}
		$(document).ready(function(){
		     	        
	        $.formValidator.initConfig({formid:"site_userform",alertmessage:false,onerror:function(msg){alert(msg)}});
			
			
			//$.formValidator.initConfig({formid:"site_userform"});
			$("#login_name").formValidator({onfocus:"用户名至少4个字符,最多10个字符",oncorrect:"该用户名可以注册"}).inputValidator({min:4,max:10,onerror:"你输入的帐号非法,请确认"})
			    .ajaxValidator({
			    type : "get",
			    async: false,
				url : "<%=path%>/ext/site_user/vlgname?userId="+document.getElementById("id").value,
				datatype : "html",
				success : function(data){
		            if( data == "success" )
					{
		                return true;
					}
		            else
					{
		                return false;
					}
				},
				onerror : "该用户名已注册不可用，请更换用户名",
				onwait : "正在对用户名进行合法性校验，请稍候..."
			}).defaultPassed();

			
		
			$("#password").formValidator().inputValidator({min:1,max:9,onerror:"密码错误,请确认"});
	        $("#email").formValidator().inputValidator({min:6,max:100,onerror:"你输入的邮箱长度非法,请确认"}).regexValidator({regexp:"^([\\w-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([\\w-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$",onerror:"你输入的邮箱格式不正确"});
			$("#name").formValidator({empty:"true"}).inputValidator({min:2,max:8,onerror:"无效姓名，请确认"});
	        
	        $("#old").formValidator({empty:"true"}).inputValidator({min:1,max:99,type:"value",onerror:"年龄必须在1-99之间，请确认"});
            $("#mobile").formValidator({empty:"true"}).inputValidator({min:11,max:11,onerror:"手机号码必须是11位的,请确认"}).regexValidator({regexp:"^[1][0-9]{10}$",onerror:"你输入的手机号码格式不正确"});;
            $("#phone").formValidator({empty:"true"}).regexValidator({regexp:"^[0-9]*$",onerror:"联系电话格式错误,请确认"});
            $("#qq").formValidator({empty:"true"}).inputValidator({min:1,max:15,onerror:"qq输入错误，请确认"}).regexValidator({regexp:"^[0-9]*$",onerror:"qq格式错误，请确认"});
            $("#adress").formValidator({empty:"true"}).inputValidator({min:1,max:30,onerror:"地址错误，请确认"});
            $("#zipcode").formValidator({empty:"true"}).inputValidator ({min:6,max:6,onerror:"邮编错误，请确认"}).regexValidator({regexp:"[0-9]{6}$",onerror:"邮编为6位数字哦，请确认"});
            $("#signatrue").formValidator({empty:"true"}).inputValidator({min:1,max:60,onerrormin:"签名太长了哦！"});
   
	   
	    });
	    
</script>
<form id="site_userform"  action="<%=path%>/ext/site_user/save" method="post" target="_self">
<table><tr><td height="2px"></td></tr></table>
<table align="center" border="0" cellpadding="0" cellspacing="1" class="table_nbw" >
	<tr >
		<td align="right" width="20%"  style="background-color:fff;height:25px;">帐号</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="login_name" name="login_name" value="${site_user.login_name}"><span style="color:red;font-weight:bold">*</span></td>
	</tr>
	<tr >
		<td align="right"   style="background-color:fff;height:25px;">密码</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="password" name="password" value="${site_user.password}"><span style="color:red;font-weight:bold">*</span></td>
	</tr>
	<tr >
		<td align="right"  style="background-color:fff;height:25px;">Email</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="email" name="email" value="${site_user.email}"><span style="color:red;font-weight:bold">*</span></td>
	</tr>
	<tr >
		<td align="right"  style="background-color:fff;height:25px;">姓名</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="name" name="name" value="${site_user.name}"></td>
	</tr>
	<tr >
		<td align="right"  style="background-color:fff;height:25px;">性别</td>
		<td align="left" style="background-color:fff">&nbsp;<input type="radio" id="sex" value="1" checked="checked" name="sex" />
        男&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" id="sex1" value="2" <%if("2".equals(site_user.getSex())){ %>checked="checked"<%} %> name="sex" />
        女</td>
      

	</tr>                                                   
	<tr >
		<td align="right" style="background-color:fff;height:25px;">年龄</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="old" name="old" value="${site_user.old}"></td>
	</tr>
	<tr >
		<td align="right"  style="background-color:fff;height:25px;">手机</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="mobile" name="mobile" value="${site_user.mobile}"></td>
	</tr>
	<tr >
		<td align="right"  style="background-color:fff;height:25px;">电话</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="phone" name="phone" value="${site_user.phone}"></td>
	</tr>
	<tr >
		<td align="right"  style="background-color:fff;height:25px;">QQ</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="qq" name="qq" value="${site_user.qq}"></td>
	</tr>
	<tr >
		<td align="right"  style="background-color:fff;height:25px;">地址</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="address" name="address" value="${site_user.address}"></td>
	</tr>
	<tr >
		<td align="right"  style="background-color:fff;height:25px;">邮编</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="zipcode" name="zipcode" value="${site_user.zipcode}"></td>
	</tr>
	<tr >
		<td align="right"  style="background-color:fff;height:25px;">个性签名</td>
		<td align="left" style="background-color:fff">&nbsp;<input class="textfiled_nbw"  type="text" id="signatrue" name="signatrue" value="${site_user.signatrue}"></td>
	</tr>
</table>
<table width="100%">
	<tr>
		<td align="center">
			<input type=hidden name="id" value="${site_user.id}" />
			<input type=hidden name="site_id" value="<%=(String) request.getSession().getAttribute(com.wing.common.Constants.SESSION_SITE_ID) %>" />
		</td>
	</tr>
</table>
</form>


